home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Triad.dxr / playing cards_55_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.6 KB  |  96 lines

  1. property spriteNum, motion, undercard, row, location
  2. global getlist, equal, currentsel, godlist, foundation, points, tableau
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   undercard = sprite(spriteNum - 4)
  7.   location = sprite(spriteNum).loc
  8. end
  9.  
  10. on mouseDown me
  11.   if foundation[row].getcardcount() > 0 then
  12.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  13.     sprite(spriteNum).locZ = spriteNum + 1000
  14.     getlist = foundation[row]
  15.     if foundation[row].getcardcount() > 1 then
  16.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  17.     else
  18.       if foundation[row].getcardcount() = 1 then
  19.         undercard.member = member("empty", "playing cards")
  20.       end if
  21.     end if
  22.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  23.   end if
  24. end
  25.  
  26. on moving me
  27.   if the mouseDown then
  28.     sprite(spriteNum).loc = the mouseLoc
  29.   else
  30.     if the mouseUp then
  31.       sprite(spriteNum).locZ = spriteNum
  32.       motion.forget()
  33.       abort()
  34.     end if
  35.   end if
  36. end
  37.  
  38. on mouseUp me
  39.   if equal then
  40.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  41.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  42.     godlist.addCard(currentsel)
  43.     sprite(spriteNum).loc = location
  44.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  45.     if foundation[row].getcardcount() > 0 then
  46.       sprite(spriteNum).member = member(foundation[row].getlastcard().membername, "playing cards")
  47.     else
  48.       if foundation[row].getcardcount() = 0 then
  49.         sprite(spriteNum).member = member("empty", "playing cards")
  50.         undercard.member = member("empty", "playing cards")
  51.       end if
  52.     end if
  53.     if objectp(tableau[sprite(currentsel).row]) then
  54.       repeat with i = 87 to 90
  55.         if tableau[sprite(i).row].getcardcount() = 0 then
  56.           next repeat
  57.         end if
  58.         sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  59.       end repeat
  60.     end if
  61.     if not objectp(foundation[sprite(currentsel).row]) then
  62.       points = points - 10
  63.     end if
  64.     equal = 0
  65.     currentsel = 0
  66.     godlist = VOID
  67.     getlist = VOID
  68.     checkwin()
  69.   else
  70.     if not equal then
  71.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  72.       getlist = VOID
  73.       sprite(spriteNum).loc = location
  74.     end if
  75.   end if
  76.   checkwin()
  77. end
  78.  
  79. on determinerow me
  80.   if spriteNum = 23 then
  81.     return #fone
  82.   else
  83.     if spriteNum = 24 then
  84.       return #ftwo
  85.     else
  86.       if spriteNum = 25 then
  87.         return #fthree
  88.       else
  89.         if spriteNum = 26 then
  90.           return #ffour
  91.         end if
  92.       end if
  93.     end if
  94.   end if
  95. end
  96.